package com.kai.mapper;


import com.kai.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {


    @Select("select exists(select 1 from users where username = #{username})")
    boolean findByUsername(String username);

    @Insert("insert into users(id, username, password, phone_number, id_card, create_time, update_time) " +
            "values (#{id},#{username},#{password},#{phoneNumber},#{idCard},#{createTime},#{updateTime})")
    void registered(User user);

    @Select("select exists(select 1 from users where username = #{username} and password = #{password})")
    boolean containUser(String username, String password);
}
